package edu.hunau.cxb.reflect;

import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;

/**
 *
 * @author hb
 *
 *         2020-04-28 14:42:13
 */
public class ClassLoaderTest {

	public static void main(String[] args) throws IOException {
		// 获得系统的类加载器
		ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
	    Enumeration<URL> em = systemClassLoader.getResources("");
	    while(em.hasMoreElements()) {
	    	System.out.println(em.nextElement());
	    }
	    //通过系统的类加载器获得父类加载器
	    ClassLoader extensionLoader = systemClassLoader.getParent();
	    System.out.println("扩展程序类加载器:"+extensionLoader);
	    System.out.println(System.getProperty("java.ext.dirs"));
	    System.out.println("启动类的类加载器:"+extensionLoader.getParent());
	}
}
